#!/usr/bin/perl -al -I../lib

use wrapMain;
no wrapMain;

our $func = "Scalar";

sub func {
    my $arg = shift;
    print "func($arg) called";
    return $arg;
}

print "Without wrapper";
print "\$func = $func";
func(undef);
print;

import wrapMain;

print "With wrapper";
print "\$func = $func";
func(undef);
print;

unimport wrapMain;

#*{'main::func'} = $sref;

print "Without wrapper";
print "\$func = $func";
func(undef);
print;

import wrapMain;

print "With wrapper";
print "\$func = $func";
func(undef);
print;

unimport wrapMain;

#*{'main::func'} = $sref;

print "Without wrapper";
print "\$func = $func";
func(undef);
print;
